package com.zhaopin.countdownlatch;

import java.util.concurrent.CountDownLatch;

/**
 * @author yin.peide
 * @date 2021-05-07 17:20
 */
public class WorkerRunnable implements Runnable{

    private final CountDownLatch doneSignal;
    private final int i;
    WorkerRunnable(CountDownLatch doneSignal, int i) {
        this.doneSignal = doneSignal;
        this.i = i;
    }

    @Override
    public void run() {
        doWork(i);
        doneSignal.countDown();
    }

    void doWork(int i) {
        System.out.println(i + "WorkerRunnable doWork" );
    }
}
